﻿using System;
using System.Collections.Generic;
using System.Text;

namespace RaisingStudio.Data
{
    [Serializable]
    public class DataColumnAttribute : Attribute
    {
        private string columnName;
        public string ColumnName
        {
            get
            {
                return this.columnName;
            }
            set
            {
                this.columnName = value;
            }
        }

        private string sourceName;
        public string SourceName        
        {
            get
            {
                return this.sourceName;
            }
            set
            {
                this.sourceName = value;
            }
        }

        private bool allowDBNull;
        public bool AllowDBNull
        {
            get { return allowDBNull; }
            set { allowDBNull = value; }
        }

        private bool autoIncrement;
        public bool AutoIncrement
        {
            get { return autoIncrement; }
            set { autoIncrement = value; }
        }

        private bool isPrimaryKey;
        public bool IsPrimaryKey
        {
            get { return isPrimaryKey; }
            set { isPrimaryKey = value; }
        }

        private bool isDbTypeNull = true;
        public bool IsDbTypeNull
        {
            get { return isDbTypeNull; }
            set { isDbTypeNull = value; }
        }

        private System.Data.DbType dbType;
        public System.Data.DbType DbType
        {
            get
            {
                return this.dbType;
            }
            set
            {
                this.dbType = value;
                this.isDbTypeNull = false;
            }
        }

        public DataColumnAttribute()
        {
            this.AllowDBNull = true;
        }

        public DataColumnAttribute(string sourceName) : this()
        {
            this.SourceName = sourceName;
        }

        public DataColumnAttribute(string sourceName, System.Data.DbType dbType)
            : this()
        {
            this.SourceName = sourceName;
            this.DbType = dbType;
        }
    }
}
